< previous page page_596 next page >

Page 596
Built-in Visual Basic Functions
Instead of using the Windows API calls, you can just use Visual Basics built-in functions to manipulate the area in the Registry in the HKEY_CURRENT_USER\Software\VB and VBA Program Settings key:
9f31265bb40b592b1929e18a47ab28e5.gif
HKEY_CURRENT_USER
    \Software
        \VB and VBA Program Settings
            \ConfigName
                \Section
                    \KeyName
The functions youll use to manipulate this area of the Registry are GetSetting, SaveSetting, DeleteSetting, and GetAllSettings.
GetSetting
The GetSetting() function returns a single data value to you when you pass in the ConfigName, Section, and KeyName values for where you want to get the data. Look in the Click of the GetSetting command button to see the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdGetSetting_Click()

   txtKeyValue = GetSetting(txtConfig, _
                          txtSection, _
                          txtKeyName, _
                          "Can't Find Entry")
End Sub
The last parameter of the GetSetting() function is a default value in case the entry youre requesting cant be found.
SaveSetting
SaveSetting places a single data value in the Registry at the location specified by the ConfigName, Section, and KeyName values. Look at the code in the SaveSetting command button to see the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdSaveSetting_Click()

   SaveSetting txtConfig, _
              txtSection, _

 
< previous page page_596 next page >

If you like this book, buy it!